/*******************************************************************************
** www.IfcGears.com                                                           **
** Copyright (C) 2010 - Bauhaus University Weimar, www.uni-weimar.de          **
** Written: 2010-10-02, Fabian Gerold, www.fabiangerold.de                    **
*******************************************************************************/

#pragma once

#include <QtGui>
#include "gears/shared_ptr.h"

class Type;
class Entity;

class Attribute
{
public:
	enum Cardinality
	{
		CARDINALITY_UNDEFINED,
		CARDINALITY_SINGLE,
		CARDINALITY_VECTOR,
		CARDINALITY_VECTOR_2D,
		CARDINALITY_VECTOR_3D
	};
	Attribute( QString name, QString comment = "" )
	{
		m_name			= name;
		m_comment		= comment;
		m_cardinality	= CARDINALITY_UNDEFINED;
	}
	virtual ~Attribute(){};
	virtual QString getDataType() = 0;
	virtual QString getDataTypeWithSmartPointer(bool weak = false) = 0;
	QString				m_name;
	QString				m_comment;
	Cardinality			m_cardinality;
};

class AttributePrimitive : public Attribute
{
public:
	AttributePrimitive( QString type, QString name, QString comment = "" ) : Attribute( name, comment )
	{
		m_primitive_type = type;
	}
	virtual QString getDataType();
	virtual QString getDataTypeWithSmartPointer(bool weak = false);
	QString				m_primitive_type;
};



class AttributeType : public Attribute
{
public:
	AttributeType( shared_ptr<Type>  type, QString name, QString comment = "" ) : Attribute( name, comment )
	{
		m_type = type;
	}
	virtual QString getDataType();
	virtual QString getDataTypeWithSmartPointer(bool weak = false);
	shared_ptr<Type> 				m_type;
};

class AttributeEntity : public Attribute
{
public:
	
	AttributeEntity( shared_ptr<Entity> ent, QString name, QString comment = "" ) : Attribute( name, comment )
	{
		m_entity			= ent;
	}
	virtual QString getDataType();
	virtual QString getDataTypeWithSmartPointer(bool weak = false);
	shared_ptr<Entity> 				m_entity;
};
